/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.openbrew.openbrewrf;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author chapmand
 */
@Entity
@Table(name = "FV")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Fv.findAll", query = "SELECT f FROM Fv f ORDER BY f.fVDesg ASC"),
    @NamedQuery(name = "Fv.findByFvid", query = "SELECT f FROM Fv f WHERE f.fvid = :fvid"),
    @NamedQuery(name = "Fv.findByFVDesg", query = "SELECT f FROM Fv f WHERE f.fVDesg = :fVDesg"),
    @NamedQuery(name = "Fv.findByFVName", query = "SELECT f FROM Fv f WHERE f.fVName = :fVName"),
    @NamedQuery(name = "Fv.findByFVMfg", query = "SELECT f FROM Fv f WHERE f.fVMfg = :fVMfg"),
    @NamedQuery(name = "Fv.findByFVRate", query = "SELECT f FROM Fv f WHERE f.fVRate = :fVRate"),
    @NamedQuery(name = "Fv.findByFVCap", query = "SELECT f FROM Fv f WHERE f.fVCap = :fVCap"),
    @NamedQuery(name = "Fv.findByFvprm", query = "SELECT f FROM Fv f WHERE f.fvprm = :fvprm"),
    @NamedQuery(name = "Fv.findPrimary", query = "SELECT f FROM Fv f WHERE f.fvprm = 'true' ORDER BY f.fVDesg ASC")})
public class Fv implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "FVID")
    private Integer fvid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 10)
    @Column(name = "FVDesg")
    private String fVDesg;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 80)
    @Column(name = "FVName")
    private String fVName;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 80)
    @Column(name = "FVMfg")
    private String fVMfg;
    @Basic(optional = false)
    @NotNull
    @Column(name = "FVRate")
    private float fVRate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "FVCap")
    private float fVCap;
    @Basic(optional = false)
    @NotNull
    @Column(name = "FVPRM")
    private boolean fvprm;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "vCVesselID")
    private Collection<VesselCleaningHistory> vchCollection;
    @OneToMany
    @JoinTable(
        name="JTFvToVCP",
        joinColumns={ @JoinColumn(name="FVID", referencedColumnName="FVID")},
        inverseJoinColumns={ @JoinColumn(name="VCPID", referencedColumnName="VCPID", unique=true)}
    )
    private List<VesselCleaningProcedure> vcpCollection;

    public Fv() {
    }

    public Fv(Integer fvid) {
        this.fvid = fvid;
    }

    public Fv(Integer fvid, String fVDesg, String fVName, String fVMfg, float fVRate, float fVCap, boolean fvprm) {
        this.fvid = fvid;
        this.fVDesg = fVDesg;
        this.fVName = fVName;
        this.fVMfg = fVMfg;
        this.fVRate = fVRate;
        this.fVCap = fVCap;
        this.fvprm = fvprm;
    }

    public Integer getFvid() {
        return fvid;
    }

    public void setFvid(Integer fvid) {
        this.fvid = fvid;
    }

    public String getFVDesg() {
        return fVDesg;
    }

    public void setFVDesg(String fVDesg) {
        this.fVDesg = fVDesg;
    }

    public String getFVName() {
        return fVName;
    }

    public void setFVName(String fVName) {
        this.fVName = fVName;
    }

    public String getFVMfg() {
        return fVMfg;
    }

    public void setFVMfg(String fVMfg) {
        this.fVMfg = fVMfg;
    }

    public float getFVRate() {
        return fVRate;
    }

    public void setFVRate(float fVRate) {
        this.fVRate = fVRate;
    }

    public float getFVCap() {
        return fVCap;
    }

    public void setFVCap(float fVCap) {
        this.fVCap = fVCap;
    }

    public boolean getFvprm() {
        return fvprm;
    }

    public void setFvprm(boolean fvprm) {
        this.fvprm = fvprm;
    }

    public List<VesselCleaningProcedure> getVcpCollection() {
        return vcpCollection;
    }

    public void setVcpCollection(List<VesselCleaningProcedure> vcpCollection) {
        this.vcpCollection = vcpCollection;
    }

    @XmlTransient
    public Collection<VesselCleaningHistory> getVCHCollection() {
        return vchCollection;
    }

    public void setVCHCollection(Collection<VesselCleaningHistory> vchCollection) {
        this.vchCollection = vchCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (fvid != null ? fvid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Fv)) {
            return false;
        }
        Fv other = (Fv) object;
        if ((this.fvid == null && other.fvid != null) || (this.fvid != null && !this.fvid.equals(other.fvid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.Fv[ fvid=" + fvid + " ]";
    }
    
}
